﻿@model dynamic
@functions {public class ReviewObj
{
    public int Vote { get; set; }
    public string Review { get; set; }
    public string UserName { get; set; }
    public int UserId { get; set; }
    public string Created { get; set; }
}
}
@{
    ViewBag.Reviews = new List<ReviewObj> { new ReviewObj() { Created = "2012-05-22T02:23:09.3300000", UserId = 1, UserName = "RentIt Admin", Review = "This is a fake, hard-coded review with the sole purpose to illustrate what an actual review would like. This has no function otherwise...", Vote = 7 } };
}
@if (true || ViewBag.User.Permissions.Contains("ReadReview"))
{
    <div class="page-header">
        <h2>
            Reviews</h2>
        <a class="btn pull-right" data-toggle="modal" href="#review-modal"><i class="icon-comment">
        </i>&nbsp;Review</a>
    </div>
    <div class="row reviews">
        <div class="span9">
            @if (ViewBag.Reviews != null)
            {
                foreach (ReviewObj review in ViewBag.Reviews)
                {
                <div class="row comment">
                    <div class="span8">
                        <blockquote class="pull-right">
                            <div class="row">
                                <div class="span8">
                                    <div class="star-rating pull-right" data-rating="@review.Vote">
                                    </div>
                                </div>
                            </div>
                            <p>
                                @review.Review</p>
                            <small><a href="@Url.Action("Index", "User", new { @id = review.UserId })">@review.UserName</a>
                                <time class="timeago" datetime="@review.Created">@review.Created</time>
                            </small>
                        </blockquote>
                    </div>
                    <img class="span1" src="@Url.Content("../../Content/img/profile.png")" width="60" height="60">
                </div>
                }
            }
            else
            {
                <p class="no-comments">
                    No reviews yet (this feature has not been implemented yet)</p>
            }
        </div>
    </div>
    <div class="modal fade hide" id="review-modal">
        <div class="modal-header">
            <button class="close" data-dismiss="modal">
                &times;</button>
            <h3>
                Review</h3>
        </div>
        <div class="modal-body">
            <div id="star">
            </div>
            <form action="" method="get">
            <textarea name="" placeholder="Write a review..." rows="3"></textarea>
            </form>
        </div>
        <div class="modal-footer">
            <a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#" data-dismiss="modal"
                class="btn btn-primary">Add review</a>
        </div>
    </div>
}